// index.js
// 获取应用实例
const app = getApp()

// banner 数据
const banner = [
  {
    id: 1,
    url: 'https://img1.baidu.com/it/u=2757217525,2091493885&fm=26&fmt=auto'
  },
  {
    id:2,
    url: 'https://img0.baidu.com/it/u=2938765701,249260041&fm=26&fmt=auto'
  },
  {
    id: 3,
    url: 'https://img2.baidu.com/it/u=3103547928,1011204065&fm=26&fmt=auto'
  },
  {
    id: 4,
    url: 'https://img1.baidu.com/it/u=379829462,3534130750&fm=26&fmt=auto'
  }
]

// 分类数据
const category = [
  {
    id: 1,
    name: '新鲜蔬菜',
    url: '/images/tab/shucai.png'
  },
  {
    id: 2,
    name: '肉禽蛋',
    url: '/images/tab/ruoqin.png'
  },
  {
    id: 3,
    name: '水产海鲜',
    url: '/images/tab/haixian.png'
  },
  {
    id: 4,
    name: '鲜花植被',
    url: '/images/tab/xianhua.png'
  },
  {
    id: 5,
    name: '新鲜水果',
    url: '/images/tab/shuiguo.png'
  },
  {
    id: 6,
    name: '糕点烘培',
    url: '/images/tab/dangao.png'
  },
  {
    id: 7,
    name: '熟食卤味',
    url: '/images/tab/shushi.png'
  },
  {
    id: 8,
    name: '速冻食品',
    url: '/images/tab/sudong.png'
  },
  {
    id: 9,
    name: '酒水饮料',
    url: '/images/tab/jiushui.png'
  },
  {
    id: 10,
    name: '粮油调味',
    url: '/images/tab/liangyou.png'
  },
  {
    id: 11,
    name: '火锅到家',
    url: '/images/tab/huoguo.png'
  },
  {
    id: 12,
    name: '休闲零食',
    url: '/images/tab/lingshi.png'
  },
  {
    id: 13,
    name: '个护清洁',
    url: '/images/tab/qingjie.png'
  }
]

// 构建推荐商品数据
const goodsList = [
  {
    id: 1,
    name: '新希望原味酸牛奶',
    spec: '1.2kg',
    info: '活菌滋养|口感浓郁',
    price: 1390,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.yzcdn.cn%2Fupload_files%2F2016%2F01%2F15%2FFvHIm2h011H3lc8TtHB9x9sTPBak.jpg%3FimageView2%2F2%2Fw%2F580%2Fh%2F580%2Fq%2F75%2Fformat%2Fjpg&refer=http%3A%2F%2Fimg.yzcdn.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639730011&t=618f6cc47d44f861e825794d7887cd2f'
  }, {
    id: 2,
    name: '海南红心火龙果',
    spec: '2个约600g',
    info: '果皮薄',
    price: 990,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fi1%2F2200790213229%2FO1CN01lJfo1e1ZivQ80RgVa_%21%212200790213229.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639730034&t=0655c96239c4033d6836e184028beb5d'
  }, {
    id: 3,
    name: '李子柒螺狮粉',
    spec: '335g',
    info: '精炖汤底',
    price: 1150,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fimgextra%2Fi2%2F2905456461%2FO1CN01HLZiAD1xbBafL3hOT_%21%212905456461.jpg_400x400.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639730057&t=9a8b7739dc16ed0da3276d64cccde373'
  }, {
    id: 4,
    name: '盐源丑苹果',
    spec: '700g',
    info: '高原生长',
    price: 790,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.defanli.com%2Fi1%2F3937086950%2FO1CN01T5IZeh21D9CjAiDqE_%21%213937086950.jpg_q90.jpg&refer=http%3A%2F%2Fimg.defanli.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639730083&t=8515d3a0005ad46eeeaed9e4b9c66e0f'
  }, {
    id: 5,
    name: '大棚黄瓜',
    spec: '600g',
    info: '凉拌清炒',
    price: 690,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic166.nipic.com%2Ffile%2F20180524%2F24969966_211021837000_2.jpg&refer=http%3A%2F%2Fpic166.nipic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639732987&t=acd84f1c60cd2610316051fd288bdd61'
  }, {
    id: 6,
    name: '鲜活鲈鱼',
    spec: '300g',
    info: '免费宰杀',
    price: 1390,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.yzcdn.cn%2Fupload_files%2F2018%2F07%2F25%2FFvLbCb22gHKaM3URWhF2OkPt8MCU.jpg%3FimageView2%2F2%2Fw%2F580%2Fh%2F580%2Fq%2F75%2Fformat%2Fjpg&refer=http%3A%2F%2Fimg.yzcdn.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639732935&t=f5d24e77edff7ed61eedc8dd426fa342'
  }, {
    id: 7,
    name: '山东丰水梨',
    spec: '600g',
    info: '山东直采|不易塞牙|汁水丰足',
    price: 990,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.defanli.com%2Fi1%2F162294211%2FO1CN01ZrGS291gygNxcDuAO_%21%21162294211.jpg_q90.jpg&refer=http%3A%2F%2Fimg.defanli.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639732911&t=0a4f5e44cdd7f5be9be7691877140311'
  }, {
    id: 8,
    name: '乌苏啤酒',
    spec: '620ml*6',
    info: '',
    price: 5290,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic2.zhimg.com%2Fv2-72f14a4648ccb1c4ff9a70517ecb0db7_1440w.jpg%3Fsource%3Db555e01d&refer=http%3A%2F%2Fpic2.zhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639732889&t=9f2cfd1d84d466c0e594c14175964ed8'
  }, {
    id: 9,
    name: '鲜活长荡湖大闸蟹',
    spec: '4只',
    info: '公母组合',
    price: 7990,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fgaitaobao4.alicdn.com%2Ftfscom%2Fi1%2F864985115%2FTB2pIcAhyFTMKJjSZFAXXckJpXa_%21%21864985115.jpg_300x300.jpg&refer=http%3A%2F%2Fgaitaobao4.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639732853&t=52118905732d39ead317e1ac1e3f987d'
  }, {
    id: 10,
    name: '高原自然熟番茄',
    spec: '500g',
    info: '酸甜均衡',
    price: 690,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimgqn.koudaitong.com%2Fupload_files%2F2015%2F07%2F25%2FFhDlPU8oMc7Y9kbXg8hhRX-KOPAG.jpg%21730x0.jpg&refer=http%3A%2F%2Fimgqn.koudaitong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639732746&t=2e0175fb1eca6213fa0592b46dc913d8'
  }, {
    id: 11,
    name: '精选琵琶腿',
    spec: '460g/袋',
    info: '骨小肉厚',
    price: 889,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fimgextra%2Fi1%2F1910146537%2FTB2_XPkspXXXXbuXpXXXXXXXXXX_%21%211910146537.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639732825&t=7526e8a507ca7600f4ce719bb608bd18'
  }, {
    id: 12,
    name: '鹃城红油郫县豆瓣酱',
    spec: '500g/瓶',
    info: '香味醇厚',
    price: 1150,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.mrshuhua.net%2FtushuJDEwLmFsaWNkbi5jb20vaTQvMjgxMTAxMjA3Ni9UQjJZbGlOa3FRb0JLTmpTWkpuWFhhdzlWWGFfISEyODExMDEyMDc2JDk.jpg&refer=http%3A%2F%2Fwww.mrshuhua.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639732772&t=a6e58a387cc030a76c472fa5d90b33e9'
  }, {
    id: 13,
    name: '正大生冻黑虎虾',
    spec: '240g',
    info: '大小匀称|优质蛋白',
    price: 3290,
    url: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage03.71.net%2Fimage03%2F54%2F07%2F93%2F68%2F357637bf-d08e-46ea-a563-0a07ecda6f6b.jpg&refer=http%3A%2F%2Fimage03.71.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639732709&t=173160f8ce2fa5fce721d3bc35143415'
  }
]

Page({
  data: { 
    goodsList: [],
    banner,
    category
  },
  onLoad() {
    this.getData()
  },
  getData() {
    this.setData({
      goodsList
    })
  },
  jumpSearch() {
    wx.navigateTo({
      url: '/pages/search/search',
    })
  }
})
